package com.cluster.user.controller;

import com.cluster.user.service.AdminFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class MinioFileController {

    @Autowired
    private AdminFileService fileService;

    /**
     * 文件上传
     *
     * @param file 上传的文件
     * @return Result
     */
    @PostMapping("/file/upload")
    public AjaxResult uploadFile(@RequestParam MultipartFile file) throws Exception {
        AjaxResult ajaxResult = new AjaxResult();
        return ajaxResult.put("url",fileService.uploadFile(file));
    }
}
